package com.kotlin.heimaplayer.widget

import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.RelativeLayout
import com.kotlin.heimaplayer.R
import com.kotlin.heimaplayer.model.WyMvItemBean
import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.item_mv.view.*

class MvItemView: RelativeLayout {
    /**
     * 适配每个view
     */
    fun setData(data: WyMvItemBean?) {
        data?.let {
            desc.text = data.creator[0].userName
            title.text = data.title
            Picasso.get().load(data.coverUrl).into(bg)
        }

    }

    constructor(context: Context?) : super(context)
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context,
        attrs,
        defStyleAttr
    )
    init {
        View.inflate(context, R.layout.item_mv,this)
    }


}